#ifndef MY_IIC_LL_H__
#define MY_IIC_LL_H__

#include "stm32g4xx_ll_gpio.h"
#include "stm32g4xx_ll_bus.h"

// OLED I2C地址
#define OLED_ADDRESS  0x78

#define OLED_SDA_PORT GPIOA
#define OLED_SDA_PIN  LL_GPIO_PIN_15
#define OLED_SCL_PORT GPIOB
#define OLED_SCL_PIN  LL_GPIO_PIN_7

// 使用LL库的宏定义
#define SDA_H   LL_GPIO_SetOutputPin(OLED_SDA_PORT, OLED_SDA_PIN)
#define SDA_L   LL_GPIO_ResetOutputPin(OLED_SDA_PORT, OLED_SDA_PIN)
#define SCL_H   LL_GPIO_SetOutputPin(OLED_SCL_PORT, OLED_SCL_PIN)
#define SCL_L   LL_GPIO_ResetOutputPin(OLED_SCL_PORT, OLED_SCL_PIN)

void OLED_Delay_us_LL(uint32_t us);
void OLED_SDA_IN_LL(void);
void OLED_SDA_OUT_LL(void);
void OLED_I2C_Start_LL(void);
void OLED_I2C_Stop_LL(void);
uint8_t OLED_I2C_Wait_Ack_LL(void);
void OLED_I2C_Send_Byte_LL(uint8_t txd);

#endif
